<?php
declare(strict_types=1);
namespace app\common\model;

use think\Model;

class AdminModel extends Model
{
    protected $name = "admin";

    public static function getDataById(int $id): array
    {
        return self::where('id',$id)->findOrEmpty()->toArray();
    }
    public static function getDataByUserName(string $userName): array
    {
        return self::where('username',$userName)->findOrEmpty()->toArray();
    }

    /**修改资料
     * @param array $where
     * @param array $data
     * @return AdminModel
     */
    public static function setDataByWhere(array $where,array $data)
    {
        return self::where($where)->update($data);
    }

}